View

View can hold children of type Element. In some case, there is a restriction on number of children it can hold.

class Aduct.Views.View.View(**kwargs)

This an abstract class, that gives an idea of methods a View must have. Unless otherwise stated, all the description of methods are generalised expected behavior of View. Depending upon the nature of view, the type of child it can hold also varies.

add_child(child)

Adds the child self.

Parameters:

child (View or Element) – The child to be added to self.

Raises:
  • ValueError – Raised when there is insufficient information to add child to self.
  • TypeError – Raised when child is of invalid type.

Note

When there is a lack of information to add child, self may try its best to add child in suitable position.

get_props()

Gets the interface properties.

Returns:A dictionary with interface properties.
Return type:dict
get_type()

Gets the interface properties.

Returns:A dictionary with interface properties.
Return type:dict
remove_child(child)

Removes the given child.

Parameters:child (View or Element) – The child which has to be removed from self.
Raises:ValueError – Raises when child is not present in self.
replace_child(old_child, new_child)

Replaces the existing child with new child.

Parameters:
  • old_child (View or Element) – The child present in self which has to be replaced.
  • new_child (View or Element) – The child that will replace old_child of self.
set_from_props(props)

Sets the interface from given properties.

Parameters:props (dict) – The dictionary containig properties of interface.